package il.ac.braude.ui.forms.questions;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPasswordField;


public class QPassword extends FormQuestion {
	private JPasswordField pw = new JPasswordField(20);
	public QPassword(String key) {
		setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
		JLabel q = new JLabel(key);
		q.setOpaque(false);
		q.setLabelFor(pw);
		add(q);
		add(Box.createHorizontalGlue());
		add(pw);
	}
	@Override
	public void setDefaultAnswer(String defaultAnswer) {
	}

	@Override
	public String getAnswer() {
		String res = new String(pw.getPassword());
		pw.setText("");
		return res;
	}

}
